/*
 * Copyright 2019-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.qijian.common.constant;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;


/**
 * @author: liaojinlong
 * @date: 2020/6/11 15:49
 * @apiNote: 关于缓存的Key集合
 */
@Component
@ConfigurationProperties(prefix = "cache")
public class CacheKey {

    public void setPrefix(String prefix) {
        PREFIX_FINAL = prefix;
    }

    public static String PREFIX_FINAL = "";

    private final static String COLON = "::";

    private final static String USER_ID = "user::id:";

    /**
     * 用户
     */
    public static String getUserId() {
        return USER_ID.replace(COLON, COLON + PREFIX_FINAL);
    }

    private final static String USER_JWT = "user::jwt:";

    /**
     * 用户列表
     */
    public static String getUserJwt() {
        return USER_JWT.replace(COLON, COLON + PREFIX_FINAL);
    }

    private final static String DATA_USER = "data::user:";

    /**
     * 数据
     */
    public static String getDataUser() {
        return DATA_USER.replace(COLON, COLON + PREFIX_FINAL);
    }

    private final static String MENU_USER_WEB = "menu::user:web:";

    /**
     * 菜单
     **/
    private final static String MENU_PID = "menu::pid:";

    public static String getMenuPid() {
        return MENU_PID.replace(COLON, COLON + PREFIX_FINAL);
    }

    private final static String MENU_ID = "menu::id:";

    public static String getMenuId() {
        return MENU_ID.replace(COLON, COLON + PREFIX_FINAL);
    }

    /**
     * 菜单
     */
    public static String getMenuUserWeb() {
        return MENU_USER_WEB.replace(COLON, COLON + PREFIX_FINAL);
    }

    private final static String MENU_USER_APP = "menu::user:app:";

    /**
     * 菜单
     */
    public static String getMenuUserApp() {
        return MENU_USER_APP.replace(COLON, COLON + PREFIX_FINAL);
    }

    private final static String ROLE_AUTH = "role::auth:";

    /**
     * 角色授权
     */
    public static String getRoleAuth() {
        return ROLE_AUTH.replace(COLON, COLON + PREFIX_FINAL);
    }

    private final static String ROLE_ID = "role::id:";

    /**
     * 角色信息
     */
    public static String getRoleId() {
        return ROLE_ID.replace(COLON, COLON + PREFIX_FINAL);
    }


    /**
     * 项目管理-首页缓存数据
     */
    public static String PROJECT_HOME_ALL = "project:home:all";

    public static String PROJECT_LIST_BUDGET = "project_list_budget";
    /**
     * 开工令完成-明细数据
     */
    public static String PROJECT_LIST_ALL_COMPLETE = "project:list:all:complete";
    /**
     * 开工令在制-明细数据
     */
    public static String PROJECT_LIST_ALL_IN = "project:list:all:in";
    /**
     * 开工令完成-统计数据
     */
    public static String PROJECT_HOME_DETAIL_ALL_IN = "project:home:detail:all:in";
    /**
     * 开工令在制-统计数据
     */
    public static String PROJECT_HOME_DETAIL_ALL_COMPLETE = "project:home:detail:all:complete";

    public static String ACCOUNT_SCORE_ALL = "account:score:all";

    /**
     * 锁定数据
     */
    public final static String LOCKING = "locking::";

    /**
     * 外协订单
     */
    public final static String OUT_ORDER_KEY = "out::order::";

    /**
     * 质量管理
     */
    public final static String QUALITY_MANAGEMENT = "quality::management";
}
